package com.link2room.rodimus.entity;

import com.link2room.common.entity.BaseEntity;
import org.hibernate.annotations.DynamicInsert;

import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Table;
import java.util.Date;


/**
 * Created by LN on 2018/1/3
 */
@Entity
@DynamicInsert
@Table(name = "sign_in_rule_base")
public class SignInRuleBaseEntity extends BaseEntity {
    public enum SignInRuleBaseEntity_ {
        code, isAutoExtension, startMonth, endMonth
    }

    private String code;
    private String isAutoExtension;
    private Date startMonth;
    private Date endMonth;
    private String description;
    private String couldReissue;
    private String title;

    @Basic
    @Column(name = "code")
    public String getCode() {
        return code;
    }

    public void setCode(String code) {
        this.code = code;
    }

    @Basic
    @Column(name = "is_auto_extension")
    public String getIsAutoExtension() {
        return isAutoExtension;
    }

    public void setIsAutoExtension(String isAutoExtension) {
        this.isAutoExtension = isAutoExtension;
    }

    @Basic
    @Column(name = "start_month")
    public Date getStartMonth() {
        return startMonth;
    }

    public void setStartMonth(Date startMonth) {
        this.startMonth = startMonth;
    }

    @Basic
    @Column(name = "end_month")
    public Date getEndMonth() {
        return endMonth;
    }

    public void setEndMonth(Date endMonth) {
        this.endMonth = endMonth;
    }

    @Basic
    @Column(name = "description")
    public String getDescription() {
        return description;
    }

    public void setDescription(String description) {
        this.description = description;
    }

    @Basic
    @Column(name = "could_reissue")
    public String getCouldReissue() {
        return couldReissue;
    }

    public void setCouldReissue(String couldReissue) {
        this.couldReissue = couldReissue;
    }

    @Basic
    @Column(name = "title")
    public String getTitle() {
        return title;
    }

    public void setTitle(String title) {
        this.title = title;
    }


    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;

        SignInRuleBaseEntity that = (SignInRuleBaseEntity) o;

        if (code != null ? !code.equals(that.code) : that.code != null) return false;
        if (isAutoExtension != null ? !isAutoExtension.equals(that.isAutoExtension) : that.isAutoExtension != null)
            return false;
        if (startMonth != null ? !startMonth.equals(that.startMonth) : that.startMonth != null) return false;
        if (endMonth != null ? !endMonth.equals(that.endMonth) : that.endMonth != null) return false;
        if (description != null ? !description.equals(that.description) : that.description != null) return false;
        if (couldReissue != null ? !couldReissue.equals(that.couldReissue) : that.couldReissue != null) return false;
        return title != null ? title.equals(that.title) : that.title == null;
    }

    @Override
    public int hashCode() {
        int result = code != null ? code.hashCode() : 0;
        result = 31 * result + (isAutoExtension != null ? isAutoExtension.hashCode() : 0);
        result = 31 * result + (startMonth != null ? startMonth.hashCode() : 0);
        result = 31 * result + (endMonth != null ? endMonth.hashCode() : 0);
        result = 31 * result + (description != null ? description.hashCode() : 0);
        result = 31 * result + (couldReissue != null ? couldReissue.hashCode() : 0);
        result = 31 * result + (title != null ? title.hashCode() : 0);
        return result;
    }
}
